<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/bootstrap/css/bootstrap.min.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/bootstrap-table.min.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/jquery-treegrid/css/jquery.treegrid.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/normalize.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/rightCon.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/thesame.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/icheck.css'"/>
    <link rel="stylesheet" type="text/css" th:href="${#request.getContextPath()}+'/static/css/popUp.css'"/>
    
    <style type="text/css">
        .table-con .table th, .table-con .table td{
            text-align: left;
        }
        table thead th{
            text-align: center;
        }
        .fixed-table-container{ border-radius:5px; border:0;  }
        .fixed-table-container td{ padding:15px }
        .fixed-table-container tbody td .th-inner, .fixed-table-container thead th .th-inner ,.bootstrap-table .table:not(.table-condensed), .bootstrap-table .table:not(.table-condensed)>tbody>tr>td, .bootstrap-table .table:not(.table-condensed)>tbody>tr>th, .bootstrap-table .table:not(.table-condensed)>tfoot>tr>td, .bootstrap-table .table:not(.table-condensed)>tfoot>tr>th, .bootstrap-table .table:not(.table-condensed)>thead>tr>td {
            padding: 15px;
        }
        .btn-primary {
            color: #fff;
            border: 0;
            border-radius: 14px;
            line-height: 28px;
            padding: 0 15px;
            margin: 0 20px 0 0;
        }
        .btn-primary:hover {
            color: #fff;
            border-color: none;
        }
        .form-horizontal .form-group {
            margin-bottom: 15px;
        }
        .treeSelect input {
            height: 34px;
            font-size: 14px;
        }
         /*取消选中效果*/
		div{
	    -moz-user-select:none;/*火狐*/
	    -webkit-user-select:none;/*webkit浏览器*/
	    -ms-user-select:none;/*IE10*/
	    -khtml-user-select:none;/*早期浏览器*/
	      user-select:none;
		}
    </style>
</head>
<body>
<div class="right-Sidebar-con">
	<article class="mb20px">
		<ul class="bread-crumb gray">
			<li class="inline-block">账号管理</li>
			<li class="inline-block darkGray">权限配置</li>
		</ul>
		<div class="pad20px mt20px overflow box-shadows bgWhite border-radius5 mb20px">
			<div class="open-list mb20px">
				<h1 class="fb mb20px">基本信息</h1>
				<ul class="overflow border1px pad15px border-radius3">
					<li><span class="gray">用户名：</span><span th:text="${user.userName}"></span></li>
					<li><span class="gray">登录账号：</span><span th:text="${user.loginName}"></span></li>
					<li><span class="gray">所属组织：</span><span th:text="${orgName}"></span></li>
					<li><span class="gray">部门职务：</span><span th:text="${user.post}"></span></li>
				</ul>
			</div>
			<div>
				<h1 class="fb mb20px">配置</h1>
				<div class="overflow border1px border-radius3">
					<div class="deploy-list overflow textCenter lh50px border-bot">
						<p class="cursor"><span data-id="addAppBtn" class="current">开通权限</span></p>
						<p class="cursor"><span data-id="addAuthBtn">数据权限</span></p>
					</div>
					<div id="addAppBtn" class="mainDiv">
						<div class="pad20px deploy-nav">
							<nav class="deploy-nav-one border1px border-radius3">
								<h1 class="border-bot pad15px gray">已开通后台功能</h1>
								<ul class="white" id="openBgApp">
									<!-- <li class="bglightBlue"><img th:src="@{/static/img/icon_msda.png}">民生档案</li>
									<li class="bgBlue"><img th:src="@{/static/img/icon_wygl.png}">物业管理</li>
									<li class="bgOrange"><img th:src="@{/static/img/icon_sqzf.png}">社区走访</li> -->
								</ul>
							</nav>
							<nav class="deploy-nav-two">
								<ul class="white">
									<li class="bgBlue"><img th:src="@{/static/img/icon_xz.png}">选择</li>
									<li class="bgOrange"><img th:src="@{/static/img/icon_yq.png}">移去</li>
								</ul>
							</nav>
							<nav class="deploy-nav-three border1px border-radius3">
								<h1 class="border-bot pad15px gray">选择要开通的功能</h1>
								<ul class="white" id="closeBgApp">
									<!-- <li class="bglightBlue"><img th:src="@{/static/img/icon_msda.png}">民生档案</li>
									<li class="bgBlue"><img th:src="@{/static/img/icon_wygl.png}">物业管理</li>
									<li class="bgOrange"><img th:src="@{/static/img/icon_sqzf.png}">社区走访</li> -->
								</ul>
							</nav>
						</div>
						<div class="pad20px deploy-nav">
							<nav class="deploy-nav-one border1px border-radius3">
								<h1 class="border-bot pad15px gray">已开通前端功能</h1>
								<ul class="white" id="openFtApp">
									<!-- <li class="bglightBlue"><img th:src="@{/static/img/icon_msda.png}">民生档案</li>
									<li class="bgBlue"><img th:src="@{/static/img/icon_wygl.png}">物业管理</li>
									<li class="bgOrange"><img th:src="@{/static/img/icon_sqzf.png}">社区走访</li> -->
								</ul>
							</nav>
							<nav class="deploy-nav-two">
								<ul class="white">
									<li class="bgBlue"><img th:src="@{/static/img/icon_xz.png}">选择</li>
									<li class="bgOrange"><img th:src="@{/static/img/icon_yq.png}">移去</li>
								</ul>
							</nav>
							<nav class="deploy-nav-three border1px border-radius3">
								<h1 class="border-bot pad15px gray">选择要开通的功能</h1>
								<ul class="white" id="closeFtApp">
									<!-- <li class="bglightBlue"><img th:src="@{/static/img/icon_msda.png}">民生档案</li>
									<li class="bgBlue"><img th:src="@{/static/img/icon_wygl.png}">物业管理</li>
									<li class="bgOrange"><img th:src="@{/static/img/icon_sqzf.png}">社区走访</li> -->
								</ul>
							</nav>
						</div>

					</div>
					<div id="addAuthBtn" class="mainDiv" style="display:none">
						<div class="pad20px deploy-fold tree">
						<!-- <ul class="organ-con has-one">
							<li>
								<div class="organ-list has-btn overflow-clear">
									<div><label for="1"><input type="checkbox" checked="checked" name="one" id="1"></label><span class="first"><img th:src="@{/static/img/arrow_down.png}"></span>一级济阳街道</div>
								</div>
								<ul class="has-two"> 
									<li>
										<div class="organ-list has-btn overflow-clear">
											<div><label for="2"><input type="checkbox" name="one" id="2"></label><span class="first"><img th:src="@{/static/img/arrow_down.png}"></span>二级银山社区</div>
										</div>
										<ul class="has-three">
											<li>
												<div class="organ-list has-btn overflow-clear">
													<div><label for="3"><input type="checkbox" name="one" id="3"></label><span class="first"><img th:src="@{/static/img/arrow_down.png}"></span>三级高荣小区</div>
												</div>
												<ul class="has-four">
													<li>
														<div class="organ-list has-btn overflow-clear">
															<div><label for="4"><input type="checkbox" name="one" id="4"></label><span class="first"><img th:src="@{/static/img/arrow_down.png}"></span>四级高荣小区</div>
														</div>
														<ul class="has-five">
															<li>
																<div class="organ-list has-btn overflow-clear">
																	<div><label for="5"><input type="checkbox" name="one" id="5"></label><span class="first"></span>五级高荣小区</div>
																</div>
															</li>
															<li>
																<div class="organ-list has-btn overflow-clear">
																	<div><label for="6"><input type="checkbox" name="one" id="6"></label><span class="first"></span>现代苑</div>
																</div>
															</li>
														</ul>
													</li>
													<li>
														<div class="organ-list has-btn overflow-clear">
															<div><label for="7"><input type="checkbox" name="one" id="7"></label><span class="first"></span>现代苑</div>
														</div>
													</li>
												</ul>
											</li>
											<li>
												<div class="organ-list has-btn overflow-clear">
													<div><label for="8"><input type="checkbox" name="one" id="8"></label><span class="first"></span>三级现代苑</div>
												</div>
											</li>
										</ul>
									</li>
								</ul>
							</li>
						</ul> -->
					</div>
						
					</div>
				</div>
			</div>
			<div class="btn-con textCenter pt20px cursor">
				<div class="inline-block textCenter overflow">
					<p class="confirm-cancel mr40px" onclick="userList()">返    回</p>
					<p class="confirm-con" id="authBtn" data-state="0" onclick="saveAuth(this)">保    存</p>
				</div>
			</div>
		</div>
	</article>
</div>

<div id="pop-ret-con-fail" style="display:none;">
	<div class="popUp">
		<div class="delete-con">
			<dl class="textCenter">
				<dt><img th:src="@{/static/img/tc_icon_sb.png}"></dt>
				<dd id="pop-ret-con-fail-msg" class="pt20px f18px fb"></dd>
			</dl>
		</div>
	</div>
</div> 

<div id="pop-ret-con-succ" style="display:none;">
	<div class="popUp">
		<div class="delete-con">
			<dl class="textCenter">
				<dt><img th:src="@{/static/img/tc_icon_cg.png}"></dt>
				<dd id="pop-ret-con-succ-msg" class="pt20px f18px fb"></dd>
			</dl>
		</div>
	</div>
</div>


<script th:src="${#request.getContextPath()}+'/static/js/jquery-2.1.3.min.js'"></script>
<script th:src="${#request.getContextPath()}+'/static/layer/layer.js'"></script>
<script th:src="${#request.getContextPath()}+'/static/js/icheck.min.js'"></script>
<script>
    var basePath = $("input#basePathInput",parent.document).val();
	var userNo = '[[${userNo}]]';
    $(function(){
   		$('.deploy-list p span').click(function(){
   			$(this).addClass('current').parent().siblings().children().removeClass('current');
   			var id = $(this).data("id");
   			if(id=='addAppBtn'){
   				$("#addAppBtn").show();
   				$("#addAuthBtn").hide();
				$("#authBtn").data("state","0");
   			}else if(id=='addAuthBtn'){
   				$("#addAppBtn").hide();
   				$("#addAuthBtn").show();
				$("#authBtn").data("state","1");
   			}
   		})
   		
   	 
   		getCloseApp();
   		getOpenApp();
   		getOrgList();
   	})
   	
   	//获取未开放的应用
   	function getCloseApp(){	
    	$.ajax({
            url:basePath + "/user/getAppByUser",
            type:"post",
            dataType:"json",
            data:{"userNo":userNo,"menuExist":"0"},
            success:function (result) {
				var bgStr="";
				var ftStr=""
                if(result.code == 200){
                	$.each(result.data,function(index,obj){
                		if(obj.PLATFORM==2){
							bgStr+='<li id="close'+obj.MENU_NO+'" data-type="Bg" data-id="'+obj.MENU_NO+'" onclick="openApp(this)" class="cursor closeApp" style="background-color:#'+obj.COLOR+'"><img src="'+basePath+'/static/img/'+obj.ICON+'">'+obj.NAME+'</li>';
						}else if(obj.PLATFORM==3){
							ftStr+='<li id="close'+obj.MENU_NO+'" data-type="Ft" data-id="'+obj.MENU_NO+'" onclick="openApp(this)" class="cursor closeApp" style="background-color:#'+obj.COLOR+'"><img src="'+basePath+'/static/img/'+obj.ICON+'">'+obj.NAME+'</li>';
						}
    				});
                	$("#closeBgApp").html(bgStr);
					$("#closeFtApp").html(ftStr);
                }
            }
    	 }) 
    }
   
    //获取已开放的应用
    function getOpenApp(){
    	$.ajax({
            url:basePath + "/user/getAppByUser",
            type:"post",
            dataType:"json",
            data:{"userNo":userNo,"menuExist":"1"},
            success:function (result) {

                if(result.code == 200){
					var bgStr="";
					var ftStr=""
                	$.each(result.data,function(index,obj){
						if(obj.PLATFORM==2){
							bgStr+='<li id="open'+obj.MENU_NO+'" data-type="Bg" data-id="'+obj.MENU_NO+'" onclick="closeApp(this)" class="cursor openApp" style="background-color:#'+obj.COLOR+'"><img src="'+basePath+'/static/img/'+obj.ICON+'">'+obj.NAME+'</li>';
						}else if(obj.PLATFORM==3){
							ftStr+='<li id="open'+obj.MENU_NO+'" data-type="Ft" data-id="'+obj.MENU_NO+'" onclick="closeApp(this)" class="cursor openApp" style="background-color:#'+obj.COLOR+'"><img src="'+basePath+'/static/img/'+obj.ICON+'">'+obj.NAME+'</li>';
						}
    				});
                	$("#openBgApp").html(bgStr);
					$("#openFtApp").html(ftStr);
                }
            }
    	 }) 
    }
    	
    //回到操作员列表
    function userList(){
    	window.location.href=basePath+"/user/index";
    }
    
    //开放应用
    function openApp(obj){
    	var menuNo = $(obj).data("id");
    	var type =  $(obj).data("type");
    	console.log("type="+type);
    	$.ajax({
            url:basePath + "/user/getMenu",
            type:"post",
            dataType:"json",
            data:{"menuNo":menuNo},
            success:function (result) {
                var data=result.data;
                if(result.code == 200){
                	var str='<li id="open'+data.menuNo+'" data-type="'+type+'" onclick="closeApp(this)" data-id="'+data.menuNo+'" class="cursor openApp" style="background-color:#'+data.color+'"><img src="'+basePath+'/static/img/'+data.icon+'">'+data.name+'</li>';
                	$("#open"+type+"App").append(str);
                	$("#close"+data.menuNo).remove();
                }else{
                	//layer.msg(result.msg);
                	retFailPop("开放失败");
                }
            }
    	 })
    }
    
   //移除应用
   function closeApp(obj){
    	var menuNo = $(obj).data("id");
	    var type =  $(obj).data("type");
	   console.log("type="+type);
    	$.ajax({
            url:basePath + "/user/getMenu",
            type:"post",
            dataType:"json",
            data:{"menuNo":menuNo},
            success:function (result) {
                var data=result.data;
                if(result.code == 200){
                	var str='<li id="close'+data.menuNo+'" data-type="'+type+'" onclick="openApp(this)" data-id="'+data.menuNo+'" class="cursor closeApp" style="background-color:#'+data.color+'"><img src="'+basePath+'/static/img/'+data.icon+'">'+data.name+'</li>';
                	$("#close"+type+"App").append(str);
                	$("#open"+data.menuNo).remove();
                }else{
                	//layer.msg(result.msg);
                	retFailPop("移除失败");
                }
            }
    	 })
    }
   
   
   
   //获取数据权限列表
   function getOrgList(){
	   $.ajax({
   		type:"post",
   		url:basePath+"/org/getAllAuthOrg",
   		dataType:"json",		
   		data:{"userNo":userNo},
   		success:function(data){
   			var str="";
   			$.each(data.children,function(index,ao){
   				if(ao.isChildExist=='1' && data.children.length>0){
   					str+='<ul class="organ-con has-one overflow-clear">';
   					$.each(ao.children,function(index,ao1){
   						str+='<li>';
   						str+='<div class="organ-list has-btn overflow-clear">';
   						str+='<div>';
   						if(ao1.authType==0){
   							str+='<label for="'+ao1.orgId+'"><input type="checkbox" data-state="0" data-parentorgid="'+ao1.parentOrgId+'" name="one" id="'+ao1.orgId+'"/></label>';
   						}else{
   							str+='<label for="'+ao1.orgId+'"><input type="checkbox" checked="checked" data-state="0" data-parentorgid="'+ao1.parentOrgId+'" name="one" id="'+ao1.orgId+'"/></label>';
   						}
   						str+='<span class="first"><img src="'+basePath+'/static/img/arrow_down.png"></span>'+ao1.orgName+'</div>';
   						str+='</div>';
   						if(ao1.isChildExist=='1'  && ao.children.length>0){
   							str+='<ul class="organ-con has-two overflow-clear">';
   							$.each(ao1.children,function(index,ao2){
   								str+='<li>';
   								str+='<div class="organ-list has-btn overflow-clear">';
   								str+='<div>';
   								if(ao2.authType==0){
   									str+='<label for="'+ao2.orgId+'"><input type="checkbox" data-state="0" data-parentorgid="'+ao2.parentOrgId+'" name="one" id="'+ao2.orgId+'"/></label>';
   								}else{
   									str+='<label for="'+ao2.orgId+'"><input type="checkbox" checked="checked" data-state="0" data-parentorgid="'+ao2.parentOrgId+'" name="one" id="'+ao2.orgId+'"/></label>';
   								}
   								if(ao2.isChildExist=='1'){
   									str+='<span class="first"><img src="'+basePath+'/static/img/arrow_down.png"></span>';
   								}
   								str+='<em>'+ao2.orgName+'</em>';
   								str+='</div>'
   								str+='</div>';
   								 if(ao2.isChildExist=='1' && ao1.children.length>0){
   									str+='<ul class="organ-con has-three overflow-clear">';
   									$.each(ao2.children,function(index,ao3){
   										str+='<li>';
   										str+='<div class="organ-list has-btn overflow-clear">';
   										str+='<div>';
   										if(ao3.authType==0){
   		   									str+='<label for="'+ao3.orgId+'"><input type="checkbox" data-state="0" data-parentorgid="'+ao3.parentOrgId+'" name="one" id="'+ao3.orgId+'"></label>';
   		   								}else{
   		   									str+='<label for="'+ao3.orgId+'"><input type="checkbox" checked="checked" data-state="0" data-parentorgid="'+ao3.parentOrgId+'" name="one" id="'+ao3.orgId+'"></label>';
   		   								}
   										if(ao3.isChildExist=='1'){
   											str+='<span class="first"><img src="'+basePath+'/static/img/arrow_down.png"></span>';
   										}
   										str+='<em>'+ao3.orgName+'</em>';
   										str+='</div>';
   										str+='</div>';
   										if(ao3.isChildExist=='1' && ao2.children.length>0){
   											str+='<ul class="organ-con has-four overflow-clear">';
   											$.each(ao3.children,function(index,ao4){
   												str+='<li>';
   												str+='<div class="organ-list has-btn overflow-clear">';
   												str+='<div>';
   												if(ao4.authType==0){
   		   		   									str+='<label for="'+ao4.orgId+'"><input type="checkbox" data-state="0" name="one" data-parentorgid="'+ao4.parentOrgId+'" id="'+ao4.orgId+'"></label>';
   		   		   								}else{
   		   		   									str+='<label for="'+ao4.orgId+'"><input type="checkbox" checked="checked" data-state="0" name="one" data-parentorgid="'+ao4.parentOrgId+'" id="'+ao4.orgId+'"></label>';
   		   		   								}
   												
   												if(ao4.isChildExist=='1'){
   													str+='<span class="first"><img src="'+basePath+'/static/img/arrow_down.png"></span>';
   												}
                   								str+='<em>'+ao4.orgName+'</em>';
   												str+='</div>';
   												str+='</div>';
   												if(ao4.isChildExist=='1' && ao3.children.length>0){
   													str+='<ul class="organ-con has-five overflow-clear">';
   													
   													$.each(ao4.children,function(index,ao5){
   		   												str+='<li>';
   		   												str+='<div class="organ-list has-btn overflow-clear">';
   		   												str+='<div>';
	   		   											if(ao5.authType==0){
	   	   		   		   									str+='<label for="'+ao5.orgId+'"><input type="checkbox" data-state="0" data-parentorgid="'+ao5.parentOrgId+'" name="one" id="'+ao5.orgId+'"></label>';
	   	   		   		   								}else{
	   	   		   		   									str+='<label for="'+ao5.orgId+'"><input type="checkbox" checked="checked" data-state="0" data-parentorgid="'+ao5.parentOrgId+'" name="one" id="'+ao5.orgId+'"></label>';
	   	   		   		   								}
   		   												if(ao5.isChildExist=='1'){
   		   													str+='<span class="first"><img src="'+basePath+'/static/img/arrow_down.png"></span>';
   		   												}
   		                   								str+='<em>'+ao5.orgName+'</em>';
   		   												str+='</div>';
   		   												str+='</div>';
   		   												str+='</li>';
   		   											})
   		   											str+='</ul>';
   												}
   												str+='</li>';
   											})
   											str+='</ul>'
   										}
   										str+='</li>';
   									})
   									str+='</ul>';
   								}
   								str+='</li>';
   							})	
   							str+='</ul>';
   						}
   						str+='</li>';
   					});
   					str+='</ul>';
   				}
   				str+='';
   				$(".tree").html(str);

   				//表单
   				$(".deploy-fold input").iCheck({
   			    	checkboxClass: 'icheckbox_square-blue',
   					radioClass: 'iradio_square-blue',
   			    	increaseArea: '20%' // optional
   			    	
   			    });
   				
   				$('input').on('ifChecked', function(e){ //ifCreated 事件应该在插件初始化之前绑定 
   					var initId = $(this).attr("id");
   				 	var state=$(this).data("state");
  				 	$(this).data("state","1");
   				 	var arr =  $(this).parent().parent().parent().parent().parent().find("input");
   					$.each(arr, function(i, obj) {  
   						$(obj).iCheck('check');
   						$(obj).data("state","1");
   			        });
   				 
   					
   				});  
   				
   				$('input').on('ifUnchecked', function(e){ //ifCreated 事件应该在插件初始化之前绑定 
   					var state=$(this).data("state");
   				 	$(this).data("state","0");
   				 	if(state==1){
	   				 	var arr =  $(this).parent().parent().parent().parent().parent().find("input");
	   					$.each(arr, function(i, obj) {  
	   						$(obj).iCheck('uncheck');
	   						$(obj).data("state","0");
	   			        }); 
   				 	}
   				 	
   					var parentOrgId=$(this).data("parentorgid");
   					$("#"+parentOrgId).data("state","2");
   					$("#"+parentOrgId).iCheck('uncheck');
   				}); 
   				
   			});
   			
   		 	$('.has-one ul').hide();
         	//组织架构
	     	$('.organ-one div.has-btn div.first-children').click(function(){
	     		$(this).parent().next('').slideToggle(300);
	     		$(this).parent().parents().siblings().find('ul').slideUp(300);
	     	})
	     	 //组织架构-弹层
	     	$('.tree-con div.has-btn , .deploy-fold div.has-btn').click(function(){
	     		$(this).next('').slideToggle(300);
	     		$(this).parent().siblings().find('ul').slideUp(300);
	     		
	     		if( $(this).find('span.first img').attr('src') == basePath+'/static/img/arrow_down.png'){
	     			$(this).find('span.first img').attr('src',basePath+'/static/img/arrow_up.png')
	     			$(this).parent().siblings().find('span.orange img').attr('src',basePath+'/static/img/arrow_down.png')
	     		}
	     		else{
	     			$(this).find('span.first img').attr('src',basePath+'/static/img/arrow_down.png')
	     		}
	     	}) 
	     	
	     	
	     	$('.tree-con').hide();
	     	$('.select-click').click(function(){
	     		$('.tree-con').slideToggle();
	     	})
   			
   		}
   	})
   }
   
   //保存数据权限
   function saveAuth(obj){
	   var state = $(obj).data("state");
	   if(state==1){
		   var orgArr = $("input[name=one]:checked").map(function(){
				return $(this).attr("id");
			}).get().join(",");
		    $.ajax({
               url:basePath + "/user/setUserAuth",
               type:"post",
               dataType:"json",
               data:{"userNo":userNo,"orgStr":orgArr},
               beforeSend: function(){
   				$("#authBtn").css("pointer-events", "none");
    		    },
               success:function (result) {
                   if(result.code==200){
                	   retSuccPop("设置成功");
                   }else{
                	   retFailPop("设置失败"); 
                   }
                   $("#authBtn").css("pointer-events", "auto");
               }
    		   
		    })
	   }else if(state==0){
		   var appArr = $(".openApp").map(function(){
		   		return $(this).data("id");
		   }).get().join(",");
		   $.ajax({
			   url:basePath + "/user/setUserApp",
			   type:"post",
			   dataType:"json",
			   data:{"userNo":userNo,"appStr":appArr},
			   beforeSend: function(){
				   $("#authBtn").css("pointer-events", "none");
			   },
			   success:function (result) {
				   if(result.code==200){
					   retSuccPop("开通成功");
				   }else{
					   retFailPop("开通失败");
				   }
				   $("#authBtn").css("pointer-events", "auto");
			   }

		   })
	   }
   }
   
   /**
    * 提示失败
    */
   function retFailPop(msg){
   	$("#pop-ret-con-fail-msg").html(msg);
   	//$("#pop-ret-con-fail-msg").html(msg);
   	layer.closeAll();
   	layer.open({
           type: 1  
           ,title: false //不显示标题栏
           ,closeBtn: false
           ,area: ['25%', '']
           ,shade: 0.8
           ,id: 'deleteFailPop' //设定一个id，防止重复弹出
           ,btnAlign: 'c'
           ,moveType: 1 //拖拽模式，0或者1
           ,shadeClose: true //设置允许点遮罩关闭
           ,content: $("#pop-ret-con-fail").html(),
           success:function(){
           },
           
       });
     }
     
   /**
    * 提示成功
    */
   function retSuccPop(msg){
   	$("#pop-ret-con-succ-msg").html(msg);
   	layer.closeAll();
   	layer.open({
           type: 1  
           ,title: false //不显示标题栏
           ,closeBtn: false
           ,area: ['25%', '']
           ,shade: 0.8
           ,id: 'deleteSuccPop' //设定一个id，防止重复弹出
           ,btnAlign: 'c'
           ,moveType: 1 //拖拽模式，0或者1
           ,shadeClose: true //设置允许点遮罩关闭
           ,content: $("#pop-ret-con-succ").html(),
           success:function(){
           },
           
       });
     }
   
</script>
</body>
</html>
